<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
		<link rel="stylesheet" type="text/css" href="./css/index2.css"/>
		<link rel="stylesheet" type="text/css" href="./css/styles.css"/>
		<script type="text/javascript" src="./js/jquery-2.1.1.min.js"></script>
		<link rel="stylesheet" type="text/css" href="./css/styless.css" />
		<script type="text/javascript" src="./js/jquery.SuperSlide.2.1.3.js"></script>
		<link rel="stylesheet" href="./css/swiper.min.css">
		<script src="./js/swiper.min.js"></script>
		<link rel="stylesheet" href="./css/stylesss.css">
		<link rel="stylesheet" type="text/css" href="./css/style.css"/>
	
		<link rel="stylesheet" type="text/css" href="./css/styl.css"/>
		<script src="./js/mejs.js"></script>
		<link rel="stylesheet" type="text/css" href="./css/bootstrap.min.css"/>
		<script src="./js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="./js/bootbox.min.js"></script>
  

	
	</head>
	<body>
		<div class="titles">
			<p>张家口途乐客车租赁</p>
			<div class="title1">
				<a href="">个人中心</a>
				<a href="">任务列表</a>
				<a onclick="tuichudriver()">退出登录</a>
			</div>
		</div>
		<script>
			function tuichudriver() {
				//退出登录
				localStorage.clear();
				window.location.href="login.html";

			}
		</script>
		  
		  <!-- <button class="btn1">点击出现弹框</button> -->
<!-- 		<div class="banner">
			<img src="imgs/timg1.jpg" >
		</div> -->
		
		
		<div id="slideBox" class="slideBox" style="width: 100%;">
			<div class="hd">
				<ul class="bannerstatename">

		
		
		
				</ul>
			</div>
			<div class="bd" style="width: 100%;">
				<ul class="bannerstate">

		
				</ul>
			</div>
		
		
		
		</div>
		
		
		
		<div class="Modeltitle">
			<p>我的车辆</p>
		</div>
		<div class="Model">

		
		
		</div>
		
		
		<div class="Modeltitle">
			<p>任务列表</p>
		</div>
		
		
		
<div class="box">
    

       
        <!--表格列表-->
        <table id="tb" class="table">
            <thead>
            <tr>
                <th>姓名</th>
                <th>出发时间</th>
                <th>出发地点</th>
                
                <th>返程时间</th>
				<th>目的地</th>
                <th>人数</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody id="show_tbody">
            <tr>
                <td>刘晓晓</td>
                <td>2020-08-01</td>
                <td>河北省/张家口市/怀来县</td>
                <td>2020-08-03</td>
                <td>北京市/延庆县</td>
                <td>10</td>
                <td>
					<a href="details.html" class="del">查看</a>
					            
                </td>
            </tr>
            <tr>
                <td>李磊</td>
                <td>2020-08-02</td>
                <td>河北省/张家口市/怀来县</td>
                <td>2020-08-05</td>
                <td>山西省/大同市/新荣区</td>
                <td>10</td>
                <td>
					<a href="details.html" class="del">查看</a>
					  
                </td>
            </tr>
            </tbody>
        </table>
    </div>
</div>
		



		
		<div class="main">
				        <div class="title">实时动态</div>
				        <div class="w-imgText" id="imgText">
				            <div class="swiperBox">
				                <ul class="swiper-wrapper">


				                </ul>
				            </div>
				            <div class="igt_page"></div>
				        </div>
				        <div class="igt_page_text">
				            <ul class="clearfix">
				            </ul>
				        </div>

				    </div>
		
		
		




		<script type="text/javascript">
			function busupdate(obj,id){
				console.log(id);
				localStorage.setItem("bus_id",id);
				window.location.href="updatebus.html";
			}

			$(function(){


				//banner图片渲染
				$.ajax({
					type:"POST",
					url:"/bannerliststate",
					datatype:'json',
					success:function(data){
						if(data.status==401){
							alert("熔断开启，系统异常");
							window.location.href="login.html";
							return;


						}
						var  lists = data.data;
						console.log(data);
						var html = "";

						for (var i = 0; i < 3; i++){

							html += '<li style="background-color: rgb(183, 159, 255); width: 100%;"><img style="width: 100%;"  src="/imgshows?picName=' + lists[i].banner_image + '" /></li>';


							$('.bannerstate').html(html);
							// html += '<li><span>' + lists[i].banner_name + '</span><div class="dot"><div class="liner"></div></div></li>';
							// $('.bannerstatename').html(html);
						}
						jQuery(".slideBox").slide({
							mainCell: ".bd ul",
							effect: "fold",
							trigger: "click",
							autoPlay: true,
							mouseOverStop: false,
							startFun:function(i,c){
								$('.bd ul li').removeClass('active').eq(i).addClass('active');
							}
						});


					}
				});

				//banner名字渲染
				$.ajax({
					type:"POST",
					url:"/bannerliststate",
					datatype:'json',
					success:function(data){
						if(data.status==401){
							alert("熔断开启，系统异常");
							window.location.href="login.html";
							return;

						}
						var  lists = data.data;
						console.log(data);
						var html = "";

						for (var i = 0; i < 3; i++){


							html += '<li><span>' + lists[i].banner_name + '</span><div class="dot"><div class="liner"></div></div></li>';
							$('.bannerstatename').html(html);
						}
						jQuery(".slideBox").slide({
							mainCell: ".bd ul",
							effect: "fold",
							trigger: "click",
							autoPlay: true,
							mouseOverStop: false,
							startFun:function(i,c){
								$('.bd ul li').removeClass('active').eq(i).addClass('active');
							}
						});


					}
				});

				 var driver_id=localStorage.getItem("driver_id");

				//客车渲染
				$.ajax({
					type:"POST",
					url:"/driverIdall",
					data:{"bus_driver_id":driver_id},

					datatype:'json',
					success:function(data){
						if(data.status==401){
							alert("熔断开启，系统异常");
							window.location.href="login.html";
							return;


						}else if(data.data != "") {
							var lists = data.data;
							console.log(data);
							var html = "";
							html += '<figure> <a href="addcar.html"> <img src="./imgs/tianjia.jpg" style="width: 150px;height: 150px;">';
							html += '<figcaption style="font-size: 17px;">添加车辆</figcaption></a></figure>';


							for (var i = 0; i < lists.length; i++) {


								html += '<figure onclick="busupdate(this,' + lists[i].bus_id + ')">';
								html += '<img src="/imgshows?picName=' + lists[i].bus_photo + '">';
								html += '<div class="Model1">';
								html += '<div class="Model2">';
								html += '<figcaption style="font-size: 17px;">' + lists[i].bus_name + '</figcaption>';
								html += '<figcaption style="color: #999999;">可乘坐人数：' + lists[i].bus_seat + '</figcaption>';
								html += ' </div><a style="color: crimson;">￥' + lists[i].bus_price + '/天</a>';
								html += '</div></figure>';

								$('.Model').html(html);

							}
						}


					}
				});


				//司机列表


				//新闻渲染
				$.ajax({
					type:"POST",
					url:"/journalismstate",
					datatype:'json',
					success:function(data){
						if(data.status==401){
							alert("熔断开启，系统异常");
							window.location.href="login.html";
							return;


						}
						var  lists = data.data;
						console.log(data);
						var html = "";

						for (var i = 0; i < 3; i++){
							// html += '<div class="title">实时动态</div><div class="w-imgText" id="imgText">';
							// html += '<div class="swiperBox">';
							// html += '<ul class="swiper-wrapper">';
							html += '<li class="swiper-slide" data-title="' + lists[i].journalism_title + '">';
							html += '<div class="item"><div class="imTB"> <div class="img">';
							html += '<img src="/imgshows?picName=' + lists[i].journalism_content1 + '"/></div>';
							html += '<div class="textB"><div class="bg_x"></div><div class="text_x">';
							html += '<div class="tt_h">' + lists[i].journalism_title + '</div>';
							html += '<p>' + lists[i].journalism_content2 + '</p>';
							html += '<div class="btn">查看更多</div></div></div></div><a href="#"></a></div></li>';
							// html += '</ul></div><div class="igt_page"></div>';
							// html += '</div><div class="igt_page_text"><ul class="clearfix"></ul></div>';
							$('.swiper-wrapper').html(html);


						}

						var imgTextId=$('#imgText');
						var swiperId=imgTextId.find('.swiperBox');
						var pagediv=imgTextId.find('.igt_page');
						var igtli=imgTextId.find('li');
						var igtliW=100*1.0/igtli.length + '%';
						var titles=[];
						var _html = '';
						igtli.each(function (index) {
							var title=$(this).attr('data-title');
							if(index===0){
								_html += '<li class="igt_li on" style="width:' + igtliW  + ';"><div class="item_span"><div class="adore"></div><div class="num">0' + (index+1) + '</div><div class="tit">' + title + '</div></div></li>';
							}else{
								_html += '<li class="igt_li" style="width:' + igtliW  + ';"><div class="item_span"><div class="adore"></div><div class="num">0' + (index+1) + '</div><div class="tit">' + title + '</div></div></li>';
							}
						});
						imgTextId.siblings('.igt_page_text').find('ul').append(_html);
						var swiper1 = new Swiper(swiperId, {
							effect : 'slide',
							autoplay : {
								delay:8000,//滚动速度
								disableOnInteraction: false,
							},
							pagination: {
								el: pagediv,
								type: 'custom',
								renderCustom: function (swiper, current, total) {
									return '<span class="on">0' + current + '</span><span>/</span><span>0' + total + '</span>';
								}
							},
							on:{
								slideChange: function(){
									var index = this.activeIndex;
									imgTextId.siblings('.igt_page_text').find('li').eq(index).addClass('on').find('.adore').addClass('bg_main');
									imgTextId.siblings('.igt_page_text').find('li').eq(index).siblings('li').removeClass('on').find('.adore').removeClass('bg_main');
								}
							}
						})
						imgTextId.siblings('.igt_page_text').on('click','li',function(){
							if (!$(this).hasClass('on')){
								var thisI = $(this).index();
								$(this).addClass('on').find('.adore').addClass('bg_main');
								$(this).siblings('li').removeClass('on').find('.adore').removeClass('bg_main');
								swiper1.slideTo(thisI, 1000, false);
							}

						});


					}
				});

			})
		</script>









	</body>
</html>
